$('.btn').hide();
var token = localStorage.getItem('tok');
//获取审批进度
$.ajax({
    type: "GET",
    url: $host+'/api/app/person/approvalProgress',
    async: true,
    dataType:'json',
    data:{
        token:token
    },
    success: function(result){
        console.log(result);
        if(result.status===500001){
            layer.msg('你尚无贷款');
        }else {
            console.log(result)
            var userInfoStatus = result.data.userInfoStatus;
            var bankStatus = result.data.bankStatus;
            var certStatus = result.data.certStatus;
            var lendStatus = result.data.lendStatus;
            if(userInfoStatus===1){
                $('.sfyz_btn').show();
                return;
            }
            if(bankStatus===1){
                $('.sfyz').text('已审核');
                $('.sfyz').addClass("active");
                $('.qbk_btn').show();
                return;
            }
            if(certStatus===1){
                $('.sfyz').text('已审核');
                $('.sfyz').addClass("active");
                $('.yhkbd').text('已绑定');
                $('.yhkbd').addClass("active");
                $('.sczj_btn').show();
                return;
            }
            if(lendStatus===1){
                $('.sfyz').text('已审核');
                $('.sfyz').addClass("active");
                $('.yhkbd').text('已绑定');
                $('.yhkbd').addClass("active");
                $('.sczjsh').text('已上传');
                $('.sczjsh').addClass("active");
                return;
            }
            if(lendStatus===2){
                $('.sfyz').text('已审核');
                $('.sfyz').addClass("active");
                $('.yhkbd').text('已绑定');
                $('.yhkbd').addClass("active");
                $('.sczjsh').text('已上传');
                $('.sczjsh').addClass("active");
                $('.fksh').text('已放款');
                $('.fksh').addClass("active");
                $('.qhk_btn').show();
            }
            if(lendStatus===3||lendStatus===null){
                $('.sfyz').text('已审核');
                $('.sfyz').addClass("active");
                $('.yhkbd').text('已绑定');
                $('.yhkbd').addClass("active");
                $('.sczjsh').text('已上传');
                $('.sczjsh').addClass("active");
                $('.sczjsh').text('放款失败');
            }
        }
    },
    error:function(){
        console.log('接口错误')
    }
});
//身份验证
$('.sfyz_btn').click(function(){
    window.location.href="shenfenyz.html?token="+token;
})
//去绑卡
$('.qbk_btn').click(function(){
    window.location.href="bangdinyhk.html?token="+token;
})
//上传证件
$('.sczj_btn').click(function(){
    window.location.href="shangchuanzj.html?token="+token;
})
//去还款
$('.qhk_btn').click(function(){
    window.location.href="woyaohk.html?token="+token;
})
//点击返回
$('.shjdfh').click(function(){
    window.location.href="gerenzx.html?token="+token;
})